import {defineStore} from "pinia";
import {getToken,removeToken} from "@/utils/token-utils";
export const useLogin = defineStore("useLogin",{
    state:():any =>{
        return{
            name:"admin",
            password:"111111",
            token:getToken() as string,

            isLogin:''
        }
    },
    actions: {
        // 登录
        async getInfo(name:any,password:any){
            return Promise.resolve('token')
        },
        //退出登录
        reset(){
            //删除local中的token
            removeToken()
            //重置token
            this.token = null
            // 清空用户信息
            this.isLogin = ''
        },
        // 获取用户信息
        getUserInfo(){
            this.isLogin = '11111'
        }
    },
})

export default useLogin
